﻿using System;

class Triple:ICloneable,IComparable<Triple>
{
    private int a;
    private int b;
    private int c;

    public Triple(int a, int b, int c)
    {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public override int GetHashCode()
    {
        unchecked
        {
            int result = 17;
            result = result * 23 + this.a.GetHashCode();
            result = result * 23 + this.b.GetHashCode();
            result = result * 23 + this.c.GetHashCode();
            return result;
        }
    }

    public static Triple operator +(Triple left, Triple right)
    {
        Triple result = new Triple(left.a + right.a, left.b + right.b, left.c + right.c);
        return result;
    }

    public static Triple operator -(Triple left, Triple right)
    {
        Triple result = new Triple(left.a - right.a, left.b - right.b, left.c - right.c);
        return result;
    }

    public static Triple operator ++(Triple input)
    {
        Triple result = new Triple(input.a + 1, input.b + 1, input.c + 1);
        return result;
    }

    public object Clone()
    {
        return new Triple(this.a, this.b, this.c);
    }

    public int CompareTo(Triple other)
    {
        int result = (this.a + this.b + this.c).CompareTo(other.a + other.b + other.c);
        return result;
    }

    public override bool Equals(object obj)
    {
        if (obj is Triple)
        {
            Triple other = obj as Triple;
            bool result = this.a.Equals(other.a) && this.b.Equals(other.b) && this.c.Equals(other.c);
            return result;
        }
        return false;
    }

    public override string ToString()
    {
        return string.Format("{0},{1},{2}",this.a,this.b,this.c);
    }
}